﻿CREATE TABLE [dbo].[Materiel] (
    [Id]            UNIQUEIDENTIFIER NOT NULL,
    [ValId]         UNIQUEIDENTIFIER NOT NULL,
    [Skapad]        DATETIME         NOT NULL,
    [SkapadAv]      NVARCHAR (50)    NOT NULL,
    [Andrad]        DATETIME         NULL,
    [AndradAv]      NVARCHAR (50)    NULL,
    [Antal]         INT              NOT NULL,
    [ByggnadId]     UNIQUEIDENTIFIER NOT NULL,
    [MaterielTypId] UNIQUEIDENTIFIER NULL,
    [Beskrivning]   NVARCHAR (200)   NULL,
    CONSTRAINT [PK_Materiel] PRIMARY KEY CLUSTERED ([Id] ASC, [ValId] ASC),
    CONSTRAINT [FK_Materiel_Byggnad1] FOREIGN KEY ([ByggnadId], [ValId]) REFERENCES [dbo].[Byggnad] ([Id], [ValId]),
    CONSTRAINT [FK_Materiel_MaterielTyp] FOREIGN KEY ([MaterielTypId], [ValId]) REFERENCES [dbo].[MaterielTyp] ([Id], [ValId])
);







